﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Hasiu.Mvc.Extensions.Pager.PagerList<Hasiu.Entity.Product>>" %>
<%@ Import Namespace="Hasiu.Mvc.Extensions.Pager" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>List</title>
    <link href="/css/zhx.css" rel="stylesheet" type="text/css" />
    <script src="/js/zhx.js" type="text/javascript"></script>
</head>
<body>
    <form action="/admin/product/list.aspx" method="get">
        <table class="table_frame">
            <tr class="header">
                <td colspan="100">筛选苗木</td>
            </tr>
            <tr>
                <td>苗木名</td>
                <td>
                    <input type="text" name="name" value="<%= Request["name"] %>" />
                </td>
            </tr>
            <tr>
                <td>苗木类型</td>
                <td>
                    <select name="productTypeId">
                        <option value="">全部</option>
                        <%
                            
                            var queryProductType = Hasiu.Service.ProductTypeService._.GetList();
                            foreach (var v in queryProductType)
                            {
                                var bj = false;
                                if (null != Request["productTypeId"] && Request["productTypeId"].Equals(v.Id))
                                {
                                    bj = true;
                                }
                        %>
                        <option value="<%= v.Id %>"<%= bj ? " selected='selected'" : "" %>><%= v.Name %></option>
                        <%
                            }
                        %>
                    </select>
                </td>
            </tr>
            <tr>
                <td>发布时间</td>
                <td>
                    <input type="text" name="startTime" datepicker="{}" value="<%= Request["startTime"]%>" />
                    ~
                    <input type="text" name="endTime" datepicker="{}" value="<%= Request["endTime"]%>" />
                </td>
            </tr>
            <tr class="footer">
                <td colspan="100">
                    <input class="btnSave" type="submit" value="搜索" />
                </td>
            </tr>
        </table>
    </form>
    <table class="table_grid">
        <tr class="header">
            <td>苗木名</td>
            <td>苗木类型</td>
            <td>发布时间</td>
            <td>图片</td>
            <td>删除</td>
        </tr>
        <%
            foreach (var v in Model)
            { 
        %>
        <tr>
            <td><a href="/admin/product/save.aspx?id=<%= v.Id %>&returnUrl=<%= Server.UrlEncode(Request.Url.PathAndQuery) %>" title="<%= v.Name %>"><%= v.Name.Sub(30) %></a></td>
            <%
                var type = Hasiu.Service.ProductTypeService._.Get(v.ProductTypeId);
            %>
            <td><%= type == null ? "--" : type.Name %></td>
            <td><%= v.AddTime.ToString("yyyy-MM-dd HH:mm:ss") %></td>
            <td><a href="/admin/product/img.aspx?productId=<%= v.Id %>&returnUrl=<%= Server.UrlEncode(Request.Url.PathAndQuery) %>">图片(<%= Hasiu.Service.ProductImgService._.GetCount(v.Id) %>)</a></td>
            <td><a href="/admin/product/del.aspx?id=<%= v.Id %>&returnUrl=<%= Server.UrlEncode(Request.Url.PathAndQuery) %>" class="tssc" title="删除">X</a></td>
        </tr>
        <%
            }
        %>
        <tr class="footer">
            <td colspan="100">
                <%= Html.Pager(Model) %>
            </td>
        </tr>
    </table>
</body>
</html>
